﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MDF.Cacher.Interfaces
{
    /// <summary>
    /// Interface caching
    /// Mr.Duc
    /// 23/2/2014
    /// </summary>
    public interface ICache
    {
        /// <summary>
        /// Get a cache with keyword
        /// </summary>
        /// <param name="_strKey">Keyword</param>
        /// <returns>A Cache object</returns>
        object Get(string _strKey);
        /// <summary>
        /// Get a cache with keyword
        /// </summary>
        /// <param name="_strKey">Keyword</param>
        /// <returns>CacheObject</returns>
        CacheObject GetCacheObject(string _strKey);
        /// <summary>
        /// Get all cache objects
        /// </summary>
        /// <returns>List of cache object</returns>
        List<CacheObject> GetAllCacheObject();
        /// <summary>
        /// Save a cache object with default time to expridate
        /// </summary>
        /// <param name="_strKey">Keyword</param>
        /// <param name="_coInput">Data to cache</param>
        /// <returns></returns>
        bool Add(string _strKey,object _coInput);
        /// <summary>
        /// Save a cache object with a time to expridate
        /// </summary>
        /// <param name="_strKey">Ketword</param>
        /// <param name="_coInput">Data to cache</param>
        /// <param name="_dtExpDate">Time to expridate</param>
        /// <returns></returns>
        bool Add(string _strKey, object _coInput, int _iMinuteToCache);
        /// <summary>
        /// Get all keys
        /// </summary>
        /// <returns>List of keywords</returns>
        List<string> GetKeys();
        /// <summary>
        /// Delete a cache object
        /// </summary>
        /// <param name="_strKeyword">Keyword to delete</param>
        /// <returns>Deleted or not</returns>
        bool Delete(string _strKeyword);
        bool Delete(List<string> _lstKeyword);
        /// <summary>
        /// Delete all cache objects
        /// </summary>
        /// <returns>Deleted or not</returns>
        bool DeleteAll();
        /// <summary>
        /// Checking existing cache object
        /// </summary>
        /// <param name="_strKey">Keyword</param>
        /// <returns>Existed or not</returns>
        bool CheckExist(string _strKey);

        void _RemoveExpridate();
    }
}
